home *** CD-ROM | disk | FTP | other *** search
/ How Many Bugs in a Box / How Many Bugs in a Box.cdr / bugs / act5 / 00242.ls < prev    next >
Encoding:
Text File  |  1995-03-28  |  1.8 KB  |  59 lines

  1. on animatebugs
  2.   global inanimate, animstage, animtimer, animshuffle, shufflestep, jostling
  3.   if not listp(inanimate) then
  4.     set animshuffle to [:]
  5.     set shufflestep to [random(6 * count(jostling)), random(6 * count(jostling))]
  6.     addProp(animshuffle, the locH of sprite 21, the locV of sprite 21)
  7.     addProp(animshuffle, the locH of sprite 22, the locV of sprite 22)
  8.     set inanimate to [the castNum of sprite 21, the castNum of sprite 22]
  9.     set animstage to [0, 0]
  10.     set animtimer to [0, 0]
  11.   end if
  12.   repeat with xxx = 1 to 2
  13.     set ystep to getAt(shufflestep, xxx) + 1
  14.     set pstep to ystep / 8
  15.     if pstep > count(jostling) then
  16.       set pstep to 1
  17.       set ystep to 1
  18.     end if
  19.     if pstep < 1 then
  20.       set pstep to 1
  21.     end if
  22.     set the locH of sprite (20 + xxx) to getPropAt(animshuffle, xxx) + getPropAt(jostling, pstep)
  23.     set the locV of sprite (20 + xxx) to getAt(animshuffle, xxx) + getAt(jostling, pstep)
  24.     setAt(shufflestep, xxx, ystep)
  25.     if getAt(animstage, xxx) = 0 then
  26.       if random(40) = 1 then
  27.         setAt(animstage, xxx, 1)
  28.         set the castNum of sprite (20 + xxx) to getAt(inanimate, xxx) + 1
  29.       end if
  30.       next repeat
  31.     end if
  32.     set ptime to getAt(animtimer, xxx)
  33.     set ptime to ptime + 1
  34.     if ptime > 5 then
  35.       if getAt(animstage, xxx) = 1 then
  36.         set the castNum of sprite (20 + xxx) to getAt(inanimate, xxx) + 2
  37.         setAt(animstage, xxx, 2)
  38.       else
  39.         set the castNum of sprite (20 + xxx) to getAt(inanimate, xxx)
  40.         setAt(animstage, xxx, 0)
  41.       end if
  42.       setAt(animtimer, xxx, 0)
  43.       next repeat
  44.     end if
  45.     setAt(animtimer, xxx, ptime)
  46.   end repeat
  47.   go(the frame)
  48. end
  49.  
  50. on BugReset
  51.   global inanimate
  52.   if listp(inanimate) then
  53.     repeat with xxx = 1 to 2
  54.       set the castNum of sprite (xxx + 20) to getAt(inanimate, xxx)
  55.     end repeat
  56.   end if
  57.   set inanimate to 0
  58. end
  59.